<template>
  <div class="feedback-page">
    <h1>问题反馈</h1>
    <el-form :model="form" label-width="100px">
      <el-form-item label="姓名">
        <el-input v-model="name" required></el-input>
      </el-form-item>
      <el-form-item label="电子邮件">
        <el-input v-model="email" type="email" required></el-input>
      </el-form-item>
      <el-form-item label="问题类型">
        <el-select v-model="issueType" placeholder="请选择" required>
          <el-option label="技术问题" value="technical"></el-option>
          <el-option label="功能建议" value="suggestion"></el-option>
          <el-option label="其他" value="other"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="问题描述">
        <el-input v-model="description" type="textarea" :rows="4" required></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElButton, ElMessage } from 'element-plus';

// 表单数据
const name = ref('');
const email = ref('');
const issueType = ref('');
const description = ref('');

// 提交表单的方法
const submitForm = () => {
  if (!name.value || !email.value || !issueType.value || !description.value) {
    ElMessage.error('请填写完整!');
    return;
  }

  // 这里可以添加提交表单的逻辑，比如发送数据到服务器
  console.log('提交的问题反馈:', {
    name: name.value,
    email: email.value,
    issueType: issueType.value,
    description: description.value,
  });

  // 清空表单
  name.value = '';
  email.value = '';
  issueType.value = '';
  description.value = '';

  ElMessage.success('问题反馈已提交，感谢您的反馈！');
};
</script>

<style scoped>
.feedback-page {
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
}
</style>
